package com.dao;

import com.jdbc.JdbcTest;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Signin {

    public boolean loginCode(String userName, String passWord) throws SQLException {
        //登录
        Connection connection = JdbcTest.getConnection();
        PreparedStatement preparedStatement = connection.prepareStatement("select * from users where name=? and password=?");
        preparedStatement.setString(1,userName);
        preparedStatement.setString(2,passWord);
        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()){
            resultSet.close();
            return true;
        }
        return false;
    }
}
